package com.lovi.string_;



public class String01 {
    public static void main(String[] args) {
        Person p1 = new Person();
        p1.name = "happy";
        Person p2 = new Person();
        p2.name = "happy";
        A a = new A();
        a.name = "happy";


        System.out.println(p1.name.equals(p2.name));//比较内容: True
        System.out.println(p1.name == p2.name);  //T(比较的都是字符串常量池里"happy"对应的地址)
        System.out.println(p1.name == "happy");   //T
        System.out.println(p1.name ==a.name); //T

        String s1 = new String("bcde");
        String s2 = new String("bcde");
        System.out.println(s1 == s2); //False

    }
}

class Person {
    public String name;
}

class A {
    public String name;
}
